package com.hfut.manage.controller;


import com.hfut.manage.pojo.Family;
import com.hfut.manage.pojo.Result;
import com.hfut.manage.service.IFamilyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zwh
 * @since 2025-06-03
 */
@RestController
@RequestMapping("/family")
public class FamilyController {

    @Autowired
    private IFamilyService familyService;

    @GetMapping
    public Result getByTeacherId(@RequestParam Long teacherId) {
        List<Family> familyList = familyService.lambdaQuery()
                .eq(Family::getTeacherId, teacherId)
                .list();
        return Result.success(familyList);
    }
}
